package com.vvlive.caibao.smartcity.ui;

import android.view.LayoutInflater;
import android.view.View;

import com.vvlive.caibao.smartcity.adapter.LifeOrderMealCanTpingjiaAdapter;
import com.vvlive.caibao.smartcity.base.BaseActivity;
import com.vvlive.caibao.smartcity.bean.LifeOrderMealEatCateBean;
import com.vvlive.caibao.smartcity.bean.LifeOrderMealStoreBean;
import com.vvlive.caibao.smartcity.utils.MyRefreshListener;
import com.vvlive.caibao.smartcity.view.CommonActionBar;
import com.vvlive.caibao.smartcity.view.PullToRefreshLayout;
import com.vvlive.caibao.smartcity.view.PullableListView;


import java.util.ArrayList;
import java.util.List;

import smartcity.vvlive.caibao.com.smartc.R;

/**
 * Created by lenovo on 2015/7/9.
 * 美食详情页
 */
public class LifeFoodDetailsActivity extends BaseActivity {
    PullableListView mPullableListView;
    List<LifeOrderMealStoreBean> mBeanList = new ArrayList<>();
    //美食对象
    LifeOrderMealEatCateBean mMealEatCateBean;
    View view;

    @Override
    protected int getContentViewRes() {
        return R.layout.refresh_list;
    }

    @Override
    public void initWidget() {
        super.initWidget();
        CommonActionBar actionbar = super.getCommonActionBar();
        actionbar.setTitle("美食详情");
        view  = LayoutInflater.from(getApplicationContext()).inflate(R.layout.life_food_details_activity,null);
        view.findViewById(R.id.order_meal_lsitem_jia).setVisibility(View.GONE);
        ((PullToRefreshLayout) findViewById(R.id.pulltorefreshlayout))
                .setOnRefreshListener(new MyRefreshListener());
        mPullableListView = (PullableListView) findViewById(R.id.life_buttom_list);
        init();
        LifeOrderMealCanTpingjiaAdapter orderMealListAdapter = new LifeOrderMealCanTpingjiaAdapter(getApplicationContext(),mBeanList);
        mPullableListView.addHeaderView(view);
        mPullableListView.setAdapter(orderMealListAdapter);
    }

    @Override
    public void widgetClick(View v) {
        super.widgetClick(v);
        switch (v.getId()){
        }
    }
    /**
     * 初始胡本地数据,测试用
     * */
    private void init(){
        mBeanList.add(new LifeOrderMealStoreBean(R.mipmap.dianpuming, "好粥道", 3, "25元起送", 0.0, 0.0, "",13.00));
        mBeanList.add(new LifeOrderMealStoreBean(R.mipmap.dianpuming,"便当",4,"25元起送",0.0,0.0,"",13.00));
        mBeanList.add(new LifeOrderMealStoreBean(R.mipmap.dianpuming, "好运来", 1, "15元起送", 0.0, 0.0, "",13.00));
        mBeanList.add(new LifeOrderMealStoreBean(R.mipmap.dianpuming, "好运来", 1, "15元起送", 0.0, 0.0, "",13.00));
        mBeanList.add(new LifeOrderMealStoreBean(R.mipmap.dianpuming, "好粥道", 3, "25元起送", 0.0, 0.0, "",13.00));
        mBeanList.add(new LifeOrderMealStoreBean(R.mipmap.dianpuming, "好粥道", 3, "25元起送", 0.0, 0.0, "",13.00));
        mBeanList.add(new LifeOrderMealStoreBean(R.mipmap.dianpuming,"麦当劳",5,"35元起送",0.0,0.0,"",13.00));
        mBeanList.add(new LifeOrderMealStoreBean(R.mipmap.dianpuming, "麦当劳", 5, "35元起送", 0.0, 0.0, "",13.00));
        mBeanList.add(new LifeOrderMealStoreBean(R.mipmap.dianpuming, "肯德基", 4, "45元起送", 0.0, 0.0, "",13.00));
        mBeanList.add(new LifeOrderMealStoreBean(R.mipmap.dianpuming, "肯德基", 4, "45元起送", 0.0, 0.0, "", 13.00));
    }
}
